using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ObjectMapper.Benchmark.DataModel
{
    internal class EmployeeDepartmentHistoryConfiguration : EntityTypeConfiguration<EmployeeDepartmentHistory>
    {
        public EmployeeDepartmentHistoryConfiguration()
        {
            ToTable("HumanResources.EmployeeDepartmentHistory");
            HasKey(x => new {x.BusinessEntityId, x.DepartmentId, x.ShiftId, x.StartDate});

            Property(x => x.BusinessEntityId)
                .HasColumnName("BusinessEntityID")
                .IsRequired()
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
            Property(x => x.DepartmentId)
                .HasColumnName("DepartmentID")
                .IsRequired()
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);
            Property(x => x.ShiftId).HasColumnName("ShiftID").IsRequired();
            Property(x => x.StartDate).HasColumnName("StartDate").IsRequired();
            Property(x => x.EndDate).HasColumnName("EndDate").IsOptional();
            Property(x => x.ModifiedDate).HasColumnName("ModifiedDate").IsRequired();
        }
    }
}